package parserdecoder

import (
	"io"
	"iptv_server/v3/v2_src/utils/common"
	"iptv_server/v3/v2_src/utils/orderedmap"
)

const (
	UNDEFINED = "? ? ? ?"
)

type ParserBuilder func(common.Sorter, common.Filter, common.Mapper) Parser
type DecoderBuilder func() Decoder

type Parser interface {
	//string, common.Sorter, common.Filter
	Parse(io.Reader) (*kkv, error)
}

type Decoder interface {
	Decode(io.Writer, *kkv) error
}

type Processer interface {
	Process(*kkv) *kkv
}

type NameUrl struct {
	name string //[]rune
	url  string
}

// key key value
type kkv struct {
	*orderedmap.Orderedmap[*orderedmap.Orderedmap[[]NameUrl]]
}

func new_kkv() *kkv {
	return &kkv{
		Orderedmap: orderedmap.New[*orderedmap.Orderedmap[[]NameUrl]](),
	}
}

// type info struct {
// 	groupName, channelName string
// }

// type KKV struct {
// 	// kv1 []string
// 	// kv2 [][]string // kv1, kv2 for order
// 	// sorted common.Sorter
// 	// filter common.Filter
// 	kvs *Orderedmap.Orderedmap[*Orderedmap.Orderedmap[[]string]]
// }
